library(car) library(MASS) source("http://www.statpower.net/Content/312/R Stuff/Steiger R Library Functions.txt") spss.data <- read.table("http://www.statpower.net/Content/312/Lecture Slides/spss.discrim.txt",header=T,sep = ",") fb.data <- read.table("http://www.statpower.net/Content/312/Lecture Slides/football.txt",header=T,sep=",") iris.data <- read.table("http://www.statpower.net/Content/312/Lecture Slides/IrisData.txt",header=T) ## spss Data ## Group 1 = customer service ## Group 2 = mechanic ## Group 3 = dispatcher ## FB Data ## Group 1 = HS fb player ## Group 2 = College fb player ## Group 3 = not a fb player ## Iris Data ## Group 1 = Virginica ## Group 2 = Versicolor ## Group 3 = Setosa ## Analyze SPSS data ## ################################## ## Create x,D,H,and Group matrices ##################################### names(spss.data) x <- as.matrix(spss.data[1:3]) Group <- as.matrix(spss.data[,4:4]) DiscriminantAnalysis(x,Group) ## Analyze FB data ## ################################## ## Create x,D,H,and Group matrices ##################################### names(fb.data) x <- as.matrix(fb.data[,2:7]) Group <- as.matrix(fb.data[,1:1]) DiscriminantAnalysis(x,Group) ## Analyze Iris Data -- TRY IT! ## stepwise discriminant analysis library(klaR) football.data <- read.table("football.txt",header=T,sep=",") fit <- greedy.wilks(GROUP ~ .,data=fb.data,niveau = .10)